package com.inspur.security.cbb3.kms.keymanager.keyorders.po;

import java.io.Serializable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import lombok.Data;

/**
 * @Description	 密钥订单表
 * @author  lijunchang
 */

@Entity
@Table ( name ="tb_keyorders" )
@Data
public class KeyOrdersBean implements Serializable {

	private static final long serialVersionUID =  4166148909386364431L;




	@Id
	@GenericGenerator(name = "idGenerator", strategy = "uuid")
	@GeneratedValue(generator = "idGenerator")
	private String uuid;

	/**
	 * 生成时间
	 */
   	@Column(name = "created_time" )
	private String createdTime;

	/**
	 * 查询条件
	 * 生成时间起
	 */
	@Transient
	@JsonIgnore
	private String createdTimeBegin;

	/**
	 * 查询条件
	 * 生成时间止
	 */
	@Transient
	@JsonIgnore
	private String createdTimeEnd;

	/**
	 * 更新时间
	 */
   	@Column(name = "updated_time" )
	private String updatedTime;

	/**
	 * 删除时间
	 */
   	@Column(name = "delete_time" )
	private String deleteTime;

	/**
	 * 是否已删除,1-是，2-否
	 */
   	@Column(name = "deleted" )
	private Boolean deleted;

	/**
	 * 密钥类型--来自SecretKeyType枚举
	 * {@link com.inspur.security.cbb3.kms.enums.SecretKeyType}
	 */
   	@Column(name = "type" )
	private String type;

	/**
	 * 订单状态
	 */
   	@Column(name = "status" )
	private String status;

	/**
	 * 订单处理报错错误码
	 */
   	@Column(name = "error_status_code" )
	private String errorStatusCode;

	/**
	 * 订单处理报错原因
	 */
   	@Column(name = "error_reason" )
	private String errorReason;


	/**
	 * 订单元数据
	 */
	@Column(name = "name" )
	private String name;

	/**
	 * 订单元数据
	 */
   	@Column(name = "meta" )
	private String meta;

	/**
	 * 生成的密钥id
	 */
   	@Column(name = "secret_id" )
	private String secretId;

	/**
	 * 生成的密钥容器id
	 */
   	@Column(name = "container_id" )
	private String containerId;

	/**
	 * 创建订单用户id
	 */
   	@Column(name = "creator_id" )
	private String creatorId;


	//=====================================返回前端组装数据========================================
	/**
	 * 对称加密，返回密钥查询数据，格式为/v1/secrets/{secret_uuid}
	 */
	@Transient
	private String secretRef;
	/**
	 * 非对称加密，返回密钥查询数据，格式为/v1/containers/{containers_uuid}
	 */
	@Transient
	private String containersRef;

}
